/*
 * @Author: gk
 * @Date:   2019-03-06 14:57:47
 * @Last Modified by:   gk
 * @Last Modified time: 2019-02-25 17:00:01
 */

function PublicFunction() {};

/**
 * 
 * 时间
 * 
 */

Date.prototype.format = function(format) { //给时间添加一个处理时间格式的函数
	var date = {
		"M+": this.getMonth() + 1,
		"d+": this.getDate(),
		"h+": this.getHours(),
		"m+": this.getMinutes(),
		"s+": this.getSeconds(),
		"q+": Math.floor((this.getMonth() + 3) / 3),
		"S+": this.getMilliseconds()
	};
	if(/(y+)/i.test(format)) {
		format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
	}
	for(var k in date) {
		if(new RegExp("(" + k + ")").test(format)) {
			format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? date[k] : ("00" + date[k]).substr(("" + date[k]).length))
		}
	}
	return format
};

/**
 *
 * 正则
 * 
 */

PublicFunction.prototype.checkPhoneNum = function(val) { //手机号验证
	return /^1\d{10}$/.test(val);
};

PublicFunction.prototype.checkEmail = function(val) { //邮箱验证
	return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(val);
};




PublicFunction.prototype.baseUrl = "https://app.kpcx179.com/";		
// PublicFunction.prototype.baseUrl = "http://tcloud.kpcx179.com/";		


var publicMethod = new PublicFunction();

export default publicMethod; //导出